#include "engine.h"

inline int BaseModule::LUA_set_mapping(lua_State *L) {
	if(!(lua_isstring(L,ARG2_1) && lua_isstring(L,ARG2_2))) return 0;
	string s1 = string(lua_tostring(L,ARG2_1)) , s2 = string(lua_tostring(L,ARG2_2));
	mapping_tag_fn[s1] = s2;
	lua_pushnumber(L,1);
	return 1;
}

inline int BaseModule::LUA_get_mapping(lua_State *L) {
	if(!lua_isstring(L,ARG1_1)) return 0;
	string s1 = string(lua_tostring(L,ARG1_1));
	map<string,string,ltstr_stl>::iterator iter = mapping_tag_fn.find(s1);
	if( iter == mapping_tag_fn.end()) return 0;
	lua_pushstring(L,iter->second.c_str());
	return 1;
}
